package lab15notepad;

public class ElectronicSecuredNotepad extends SecureNotepad implements IElectronicDevice {

	private boolean isStarted;
	
	@Override
	public void start() {
		isStarted=true;

	}

	@Override
	public void stop() {
		isStarted=false;
		
	}

	@Override
	public boolean isStarted() {
		return isStarted;
	}

	@Override
	public void setTitle(String title, int page) {
		if (isStarted()) super.setTitle(title, page);
		else System.out.println("Device is off.");
	}

	@Override
	public void addText(String text, int page) {
		if (isStarted()) super.addText(text, page);
		else System.out.println("Device is off.");
	}

	@Override
	public void replaceText(String text, int page) {
		if (isStarted()) super.replaceText(text, page);
		else System.out.println("Device is off.");
	}

	@Override
	public void deleteText(int page) {
		if (isStarted()) super.deleteText(page);
		else System.out.println("Device is off.");
	}

	@Override
	public void showPage(int page) {
		if (isStarted()) super.showPage(page);
		else System.out.println("Device is off.");
	}

	@Override
	public void showAll() {
		if (isStarted()) super.showAll();
		else System.out.println("Device is off.");
	}

	@Override
	public void searchWord(String word) {
		if (isStarted()) super.searchWord(word);
		else System.out.println("Device is off.");
	}

	public ElectronicSecuredNotepad() {
		super();
		isStarted=true;
	}

	public ElectronicSecuredNotepad(String title, int pageNumber, String password) {
		super(title, pageNumber, password);
		isStarted=true;
	}

	@Override
	public void printAllPagesWithDigits() {
		if (isStarted()) super.printAllPagesWithDigits();
		else System.out.println("Device is off.");
	}

}
